<?php
/**
 * @developer socheat 
 * @copyright 2012
 */
$report = mysql_query("SELECT * FROM counter
            INNER JOIN tblproduct AS pro ON pro.`id`=counter.`pd_id`
            WHERE by_user='" . $_SESSION['acc_id'] . "'  AND count_type='counter' ORDER BY top_view DESC LIMIT 0,5");
// new email       
$email_n = mysql_query("SELECT * FROM contact WHERE to_user='" . $_SESSION['username'] . "' AND STATUS=0");
$mail_rows = mysql_num_rows($email_n);


// personal page seller
$strin = "";
$st = $_SESSION['acc_id'];
$company = new company();
$company->getcompany($strin, $st);
// end personal page seller
// last post
$sts = "owner='" . $_SESSION['acc_id'] . "' ORDER BY id DESC LIMIT 0,5";
$product = new prodcut_tb();
$GetAll = $product->product_list($sts);
// end last post
// count post
$pro_count = "owner='" . $_SESSION['acc_id'] . "'";
$product = new prodcut_tb();
$procount = $product->product_list($sts);
$num_rows = mysql_num_rows($procount);
// end count post   
//check order
$orderfrom = "pro.owner='".$_SESSION['acc_id']."'";
//$orderfrom = $_SESSION['acc_id'];
$check_order = new chOder();
$check_ord = mysql_num_rows($check_order->chOrder($orderfrom));


//end check order
?>

<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" />
<style>
    .toggler
    {
        margin: 10px 0 0 0;
    }
    .button {		
        text-decoration: none;        
    }
    .point
    {
        cursor: pointer;
    }
    #effect {
        position: relative;
        padding: 0.4em;
    }
    #effect h3 {
        margin: 0;
        padding: 0.4em;
        text-align: center;
        font-size: 14px;
        display:block;
    }
    .t_none
    {
        border:none;
    }
</style>
<script>
    $(function() {
        // run the currently selected effect

        $(".button").click(function () {
            $(".table_views").toggle("slideUp");
        });
        
        $(".button_last").click(function () {
            $(".table_last").toggle("fast");
        }); 
        
        $(".button_top").click(function () {
            $(".table_top").toggle("fast");
        });    

    });
</script>
<!--right now-->
<div class="toggler">
    <div id="effect" class="ui-widget-content ui-corner-all">
        <h3 class="button point ui-widget-header ui-corner-all"><!--Right Now--><?php echo $lang['RIG_NOW']; ?></h3>
        <table class="table_views t_none" width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td align="center" valign="middle"><!--New Email:--><?php echo $lang['NEWEMAIL']; ?></td>
                <td class="right" valign="middle"><a href="<?php echo W_ROOT; ?>/company/action/?p=email/index">(<strong><span style="color: #ff0000;"><?php echo $mail_rows; ?></span></strong>) inbox</a></td>
            </tr>
            <tr>
                <td align="center" valign="middle"><!--New order:--><?php echo $lang['NEWORDERR']; ?></td>
                <td class="right" valign="middle"><a href="<?php echo W_ROOT; ?>/company/action/order/index.php">(<strong><span style="color: #ff0000;"><?php echo $check_ord ?></span></strong>) order</a></td>
            </tr>
            <tr>
                <td align="center" valign="middle"><!--Page views:--><?php echo $lang['PAGE_VIEW']; ?></td>
                <td class="right" valign="middle"><?php echo $company->views; ?></td>
            </tr>
            <tr>
                <td align="center" valign="middle"><!--Content:--><?php echo $lang['CONTENT']; ?></td>
                <td class="right" valign="middle"><a href="<?php echo W_ROOT; ?>/seller/product/"><strong><?php echo $num_rows; ?></strong> Products</a></td>
            </tr>
        </table>
    </div>
</div>
<!--end right now-->    

<!--last article-->    
<div class="toggler">
    <div id="effect" class="ui-widget-content ui-corner-all">
        <h3 class="button_last point ui-widget-header ui-corner-all"><!--Last 5 Added Articles--><?php echo $lang['LAST_ADD_ARTICLE']; ?></h3>    
        <table style="display: none;" class="table_last t_none" width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td align="center" valign="middle"><strong><!--ID--><?php echo $lang['ID']; ?></strong></td>
                <td align="center" valign="middle"><strong><!--Product name--><?php echo $lang['PRODUCTNAME']; ?></strong></td>
            </tr>

            <?php
            $i = 1;
            while ($ros = mysql_fetch_array($GetAll)) {
                $i++;
                ?>
                <tr>
                    <td><?php echo $ros['id']; ?></td>
                    <td><?php echo $ros['product_name']; ?></td>
                </tr>        
                <?php
            }
            ?>

        </table>
    </div>
</div>
<!--end last article--> 


<!--top article-->    
<div class="toggler">
    <div id="effect" class="ui-widget-content ui-corner-all">
        <h3 class="button_top point ui-widget-header ui-corner-all"><!--Top 5 Popular Articles--><?php echo $lang['TOP5_POP']; ?></h3>    
        <table style="display: none;" class="table_top t_none" width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td width="9%" align="center" valign="middle"><strong><!--ID--><?php echo $lang['ID']; ?></strong></td>
                <td width="74%" align="center" valign="middle"><strong><!--Product name--><?php echo $lang['PRODUCTNAME']; ?></strong></td>
                <td width="17%" align="center" valign="middle"><strong><!--Hits--><?php echo $lang['HITS']; ?></strong></td>
            </tr>

            <?php
            $i = 1;
            while ($report_get = mysql_fetch_assoc($report)) {
                $i++;
                ?>
                <tr>
                    <td><?php echo $report_get['id']; ?></td>
                    <td><?php echo $report_get['product_name']; ?></td>
                    <td><?php echo $report_get['top_view']; ?></td>
                </tr>        
                <?php
            }
            ?>

        </table>
    </div>
</div>
<!--end top article--> 